/**
 * Client.java
 * @author taowei20061122@163.com
 * 2013-6-9 下午6:46:37
 */
package study.designpattern.proxy;

import java.util.List;

/**
 * 客户端测试类
 * @author taowei20061122@163.com
 * 2013-6-9 下午6:46:37
 */
public class Client {

	/**
	 * @param args
	 */
	public static void main(String[] args) {
		UserManager userManager = new UserManager();
		List<UserModelApi> userList = userManager.getUserByDepId("1");
		
		//如果只是显示用户名称，则不需要重新查询数据库
		for (int i = 0; i < userList.size(); i++) {
			UserModelApi userModelApi = userList.get(i);
			System.out.println("userId="+userModelApi.getUserId()+" name="+userModelApi.getName());
		}
		
		//如果访问除用户名称以外的属性，则需要重新查询数据库
		for(UserModelApi userModelApi: userList) {
			System.out.println("userId="+userModelApi.getUserId()+" name="+userModelApi.getName()+" depId="+userModelApi.getDepId());
		}
		for(UserModelApi userModelApi: userList) {
			System.out.println("userId="+userModelApi.getUserId()+" name="+userModelApi.getName()+" depId="+userModelApi.getDepId());
		}
	}

}
